package com.yyx.BeanPostProcessor;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.stereotype.Component;

@Component
public class ImitateAopBeanPostProcessor  implements BeanPostProcessor {

    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {

        //spring bean name命名生成规则类名首字母小写
        // 特殊情况——当类名的首字母和第二个字母是大写的时候，将采用原始的类名作为beanName。
        if(beanName.equals("userDaoImpl1")){
            System.out.println("奥利给");
        }
        return bean;
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        return null;
    }


}
